package action;

import com.opensymphony.xwork2.ActionSupport;

/**
 * @author dingyuanwei
 * @version 建立時間：Dec 24, 201011:34:01 AM
 * 類別說明:
 */
public class LoginAjaxAction extends ActionSupport {
	
	private String username;
	private String psw;
	private int age;
	
	public int getAge() {
		return age;
	}

	public void setAge(int age) {
		this.age = age;
	}

	public String getPsw() {
		return psw;
	}

	public void setPsw(String psw) {
		this.psw = psw;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	@Override
	public void validate() {
		if("dyw".equals(username)){
			this.addFieldError("username", "该用户名已存在！");
		}
		if("".equals(psw)){
			this.addFieldError("psw", "密码不能为空！");
		}
		if(age >100 || age < 0){
			this.addFieldError("age", "年齡应譔在0－100之间");
		}
	}

	

}
